home *** CD-ROM | disk | FTP | other *** search
- l2p.doc for Version 0.51
-
- 1. General
-
- 1.0. DISCLAIMER
-
- LEGO(tm) is a trademark of The LEGO Group (TLG). I am not related to TLG
- in any way. POV-Ray(tm) is a trademark of the POV-Ray Team (tm).
-
-
- 1.1. What is l2p ?
-
- l2p is a converter from James Jessimans LDraw to POV-Ray. Models created
- with LDraw can be nicely rendered by POV-Ray when converted with l2p.
- l2p is (C) by Lutz Uhlmann 1997,1998.
-
-
- 1.2. What do I need to run l2p ?
-
- Of course you need the LDraw package to create the models. This package
- is not included, the most recent version is available for download at
- James's homepage, "http://silo.riv.csu.edu.au:80/~jjessiman/lego/ldraw/".
- To run LDraw, you need DOS or a DOS emulating environment.
- Also you need POV-Ray 3.0, which is available for various platforms at
- "http://www.povray.org".
- At last you need the "lgeo" package for POV-Ray. "lgeo" is an acronym
- for "Lego Geomtrical Equivalent Objects", this package defines LEGO(tm)
- compatible objects and colors for POV-Ray. All objects have are orientated
- the same as in LDraw, because it was mainly desgined to work with l2p.
-
-
- 1.3. What should the l2p package contain ?
-
- This package contains at least nine files:
- go32.exe
- l2p
- l2p.exe
- l2p.doc
- l2p_colr.tab
- l2p_elmt.tab
- l2p_ptrn.tab
- light.dat
- spotlite.dat
- l2p.exe is a Win32 console application version, which should work on
- Win 95, Win 98 and Win NT 4.0. L2p.doc is the one you read, l2p_colr.tab,
- l2p_elmt.tab and l2p_ptrb.tab are table files specifying the LDraw parts
- and colors supported by my lgeo package. They are essential for l2p to
- operate. Any part or color not found in these files will not be converted.
- l2p is the Linux ELF Binary. Light.dat and the spotlite.dat are light
- sources to be used in Ledit to place lights. So copy these to files to your
- LDRAW\PARTS directory and try around. The spotlite has an arrow to indicate
- the direction of the light, so try some rotations.
-
-
- 2. How to run l2p
-
- 2.1. Location of files
-
- The only files needed are l2p_colr.tab, l2p_elmt.tab and l2p_ptrn.tab.
- They must be located in the directory from which l2p is called. I just put
- all the l2p-files in my LDraw directory.
-
-
- 2.2. Calling l2p
-
- l2p is called via command line "l2p [options] <source> <destination>".
- By default, if not given, a ".pov" suffix is added to the destination. The
- options accepted by l2p are:
- -f Generate a full scene with a camera
- -h display help.
- -i Suffix '.inc' for generated files.
- -l Convert LDRAW Object "light.dat" to lightsources.
- -t Print a table of used parts (converted ones only)
- -v Verbose, print information about piece counts etc.
- -s[n] Generate scene for each step.
- If n is given, generate file only for step n
-
- Each generated file will contain the required #include diectives to in-
- clude the parts and colors from the lgeo package to render the model. You
- just have to set up a camera and perhaps some additional lights. Of course
- you can modify the scene file to your like, perhaps include some fog, halos
- or anything you want.
-
- New for version 0.2 is the submodel feature. For each part which does not
- apply to the standard part names, beginning with a number, a #include line
- will be generated. The whole included file will be bound to one object by a
- union or merge command and textured with the color given. So if there are
- any parts in the included model with color 16, they will be colored in this
- color, like in LDraw. Color 24 is not supported. Of course you will have to
- convert the included models themselves, with the -i switch set to generate
- ".inc" suffixed files.
- There are two example files, "test_inc.dat" (submodel) and "inc_test.dat"
- zipped for download iavailable at my homepage. Main file is "inc_test.dat"
- which places three of the submodels in different partial colors on a green
- baseplate. Check these files to get the idea how this works. I have not
- tested it, but it should also work recursively, with submodels in the sub-
- model. I also am not sure how the results for transparent colored submodels
- will be, as I can not determine which color will be used if a part is used
- with color number 16. In this case, the whole submodel is merged instead of
- using a union.
- Another problem may occur with people making their own parts, and naming
- them. They may be misinterpreted as a LDraw part when the names first char
- is a digit (0-9) and not will not converted at all, or otherwise they will
- be interpreted as a submodel, which is not available, because it is not a
- real submodel. I have to set a break here, so l2p will support only parts
- with official LEGO(tm) parts numbers, or 'unknown' numbers given to them by
- James Jessiman, the author of LDraw. All parts not apllying to this rules
- may be misinterpreted, until I rewrite l2p from scratch (maybe never).
- New for version 0.3 is the ability to work with moved part numbers. So if
- you still use for example part 9 (1x8 plate) in your model, which has moved
- to 3460, l2p will count and include this part as 3460. So do not be afraid
- when you use L2P with the -t table option get some part numbers you did not
- use in your model. The parts moved are deleted from the LGEO Library with
- their old numbers and only used with the new numbers. You should not need
- to worry about your older models, but for the future better use the new
- numbers.
- New for version 0.31 is the ability of generating a printout of parts not
- in the LGEO Library yet. Use the "-m" option to see the missing parts.
- New for version 0.4 are patterned parts. Therefore, a new data file with
- the actually implemented patterns called "l2p_ptrn.tab" is needed. Because
- of the limitations to a 8.3 file name, the patterns have a file name not
- matching the pattern name. The pattern include files for POV-Ray are to be
- located is the "patterns" subdirectory in your LGEO directory. If a pattern
- is not available, an undecorated version of the part is used, if available.
- New for Version 0.5 is the camera generating feature using the "-f" com-
- mand line switch. Read section 2.2.7. for details.
- Version 0.51 fixes some minor bug in the default camera generating and
- adds the feature of directed lights.
- Version 0.52 fixes a bug with submodels in submodels using color 16, re-
- ported by Jacob Sparre Anderson. L2P also does not give a table with the
- stupid %NaN number when processing a file completely using submodels and no
- real parts.
- Version 0.53 adds the feature for multiple used part number or subparts,
- like 3709 (Technic Plate 2x4) and 3709a (Brick 2 x 4 with holes) as an ex-
- ample for multiple parts and 89 (Technic Universal Joint), which has to be
- used separately with 89a and 89b if a specific angle is needed as example
- for subparts.
-
-
- 2.2.1. -i command line switch
-
- If "-i" or "-I" is specified in the command line, instead of the ".pov"
- suffix, a ".inc" suffix is added to the destination file name. Note that
- even "l2p -i mymodel.dat mymodel.pov" will generate a file "mymodel.inc".
-
-
- 2.2.2. -l command line switch
-
- If you specify "-l" or "-L" in the command line, the LDraw object
- "light.dat" will be converted to a light source. Currently the color of the
- object is not converted, l2p just will create a white light. This will be
- changed in future probably. If this option is not given, the "light.dat"
- objects will not be converted.
- New in version 0.51 is the conversion of the LDraw object "spotlite.dat"
- to directed Light sources. These Lightsources emit a cone of light into the
- direction of the arrow, but these lights are not as bright as normal light-
- sources, so I think a scene just with directed lights will be to dark in
- any case.
-
-
- 2.2.3. -t command line switch
-
- The "-t" or "-T" switch will generate a table which lists the LDraw parts
- converted by l2p:
-
- Used parts in quantity:
- Part Part Part Part Part
- 28: 11 101: 12 148: 11 2431: 2 2445: 9
- 3001: 2
-
- If more steps of a model is converted (see -s command line switch), the
- table contains the quantities of the last generated step.
-
-
- 2.2.4. -v command line switch
-
- If "-v" or "-V" is given as an option, l2p will print some general
- informations about the conversion, as shown below:
-
- Converting mymodel.dat to mymodel.pov.
- Generating each step.
- Total Number of Steps: 1
- Total Number of Parts: 36
- Total Number of Lights: 0
-
-
- 2.2.5. -m command line switch
-
- This option lets l2p print a (unsorted) list of the parts used in your
- model, which are not in LGEO now. I fear this to be a shot in my knee, as
- people now will mail me for needing this one special part...
-
-
- 2.2.6. -s[n] command line switch
-
- With the "-s" or "-S" option specified, l2p will generate each step of
- the models as a single file instead of the complete model in one file. The
- step number will be appended to the destination file name.
- If an additional integer is specified, e.g. "-s4", only this step will be
- generated. All parts used until the specified step (inclusive) will be con-
- verted.
-
-
- 2.2.7. -f command line switch
-
- When specifying the "-f" or "-F" switch, l2p generates a full scene ready
- to render, with a camera about the standard LDraw viewing angle and some
- general lights. Do not use this option on submodels, since then you will
- have multiple camera setups.
- When generating such a full scene, you also cannot forget to include the
- "lg_defs.inc" and "lg_color.inc" files, which seems to be a common source
- of errors. The camera position is calculated by using the maximum ranges
- of parts locations, not including the size of the parts, so it is somewhat
- imperfect. If you do not like the setup, just use a text editor to change
- the location and look_at of the camera in the generated files.
- Not that since this is a full scene, the maybe specified "-i" switch to
- generate a "*.inc" instead of a "*.pov" file will be overridden, so when
- "-f" is specifid you always will get a "*.pov" file.
-
-
- 2.3. Colors
-
- The colors from LDraw are converted as shown in the list below. Any other
- color number not listed will be converted to a color called "lg_undefined".
- This is a light blue with no LEGO(tm) equivalent, so it should be easy to
- detect parts with incorrect colors in your traced picture. Color number 16
- will not be textured at all, to work with the submodel feature (New for l2p
- v0.2).
-
- LDraw Color LEGO(tm) Color
- 0 black
- 1 blue
- 2 green
- 4 red
- 5 purple (dark violet, as in Technic set 8277)
- 6 brown
- 7 gray
- 8 dark gray
- 13 pink (e.g. in Belville)
- 14 yellow
- 15 white
- 33 clear blue
- 34 clear green
- 36 clear red
- 42 clear neon green (fluorescent yellow)
- 43 clear cyan
- 44 clear neon orange (fluorescent orange)
- 46 clear yellow
- 47 clear white (colorless)
- 334 gold (reflecting)
- 382 tan (beige, desert)
- 434 dark cyan (e.g. in New Technic Models)
- 503 chrome (reflecting)
- 506 mint (e.g. in Belville)
- 509 rose (e.g. in Paradisa)
- 510 light yellow (e.g. in Belville)
-
-
- 2.4. Parts
-
- The parts defined in the lgeo library for POV-Ray have the same name as
- the LDraw parts, with a "lg_" prefix. They also have the same orientation,
- but with a different unit size. The scaling is done by L2P. Just look at
- the LGEO directory to see which parts will be acknowledged by L2P. If you
- have the latest version of the "l2p_elmt.tab" file, they should all be
- known to L2P.
-
-
- 2.5. Error handling
-
- 2.5.1. "Cannot open file <l2p_colr.tab>" and
- "Cannot open file <l2p_elmt.tab>" and
- "Cannot open file <l2p_ptrn.tab>"
-
- One of the convert table files could not be found. Make sure they are
- present in the directory you are working in.
-
-
- 2.5.2. "Cannot open Input file ..."
-
- The specified input file could not be opened. Check path and filename.
-
-
- 2.5.3. "Cannot open Output file"
-
- The current output file could not be opened. It may be existant and pro-
- tected or the disk may be full.
-
-
- 2.5.4. "Could not allocate memory for ..."
-
- This may occur for any allocations to be made. Building the converting
- tables from the convert table files or reading the input file. Free some
- memory and try again. The memory needed for one part from the conversion
- table is a maximum of 32 bytes, depending on the name of the part, each
- part from the input file needs 68 bytes. The color table needs about 600
- bytes maximum.
-
-
- 3. Future plans
-
- What I want to implement for the future:
-
- Colored lights
-
- The color of a light element will be translated into a colored light
- source for POV-Ray.
-
- Convert Steps without previous parts
-
- This option will only generate the POV-Ray scene file containig the
- parts in the current step, not all elements upto this step, as it does
- now.
-
-
- 4. The closing
-
- Feel free to contact me for any reason about l2p. If you have some bugs
- detected, describe them as exact as possible. If neccessary, send me a copy
- of the LDraw file causing the error.
- Suggestions are welcome too. Also are donations.
-
- You can contact me by e-mail:
-
- Chaotix@T-Online.de
-
- Or take a look at my Homepage for latest news on L2P/LGEO:
-
- http://titan.informatik.uni-bonn.de/%7Euhlmann/
-
-
- Have fun,
-
- Lutz
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-